package com.tianji.learning.service.impl;

import com.tianji.common.utils.BeanUtils;
import com.tianji.common.utils.CollUtils;
import com.tianji.learning.domain.po.PointsBoardSeason;
import com.tianji.learning.domain.vo.PointsBoardSeasonVO;
import com.tianji.learning.mapper.PointsBoardSeasonMapper;
import com.tianji.learning.service.IPointsBoardSeasonService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.tianji.learning.constants.LearningConstants.POINTS_BOARD_TABLE_PREFIX;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zzj
 * @since 2024-05-12
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class PointsBoardSeasonServiceImpl extends ServiceImpl<PointsBoardSeasonMapper, PointsBoardSeason> implements IPointsBoardSeasonService {


    @Override
    public List<PointsBoardSeasonVO> queryBoardSeasonList() {
        List<PointsBoardSeason> list = this.list();
        if (CollUtils.isEmpty(list)){
            return CollUtils.emptyList();
        }
        List<PointsBoardSeasonVO> seasonVOList = BeanUtils.copyList(list, PointsBoardSeasonVO.class);
        return seasonVOList;
    }

    /**
     * @description: 创建上赛季的表 
     * @params: [id]       
     * @return: 
     * @author: ajie
     * @date: 2024/5/16 17:34
     */
    @Override
    public void createPointsBoardLatestTable(Integer id) {
        getBaseMapper().createPointsBoardTable(POINTS_BOARD_TABLE_PREFIX + id);
        
    }
}
